<h3><?php
import_js("picker/jquery-ui.min.js");

echo $title; ?></h3>
<script >
/* $("#date").datepicker({
			minDate: '0Y',   maxDate: '4Y',  
			numberOfMonths: 1,  dateFormat: 'dd/mm/yy',
			monthNames: ['Một','Hai','Ba','Tư','Năm','Sáu','Bảy','Tám','Chín', 
			'Mười','Mười một','Mười hai'] ,
			monthNamesShort: ['Tháng1','Tháng2','Tháng3','Tháng4','Tháng5',
			'Tháng6','Tháng7','Tháng8','Tháng9','Tháng10','Tháng11','Tháng12'] ,
			dayNames: ['Chủ nhật', 'Thứ hai', 'Thứ ba', 'Thứ tư', 'Thứ năm',
			 'Thứ sáu', 'Thứ bảy'],
			dayNamesMin: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'] ,
			showWeek: true , showOn: 'both',
			changeMonth: true , changeYear: true,
			currentText: 'Hôm nay', weekHeader: 'Tuần'
			});
*/
$(function() {
		$("#date").datepicker({
			minDate: '0Y',   maxDate: '4Y',  
			numberOfMonths: 1,  dateFormat: 'dd/mm/yy',
			monthNames: ['Một','Hai','Ba','Tư','Năm','Sáu','Bảy','Tám','Chín', 
			'Mười','Mười một','Mười hai'] ,
			monthNamesShort: ['Tháng1','Tháng2','Tháng3','Tháng4','Tháng5',
			'Tháng6','Tháng7','Tháng8','Tháng9','Tháng10','Tháng11','Tháng12'] ,
			dayNames: ['Chủ nhật', 'Thứ hai', 'Thứ ba', 'Thứ tư', 'Thứ năm',
			 'Thứ sáu', 'Thứ bảy'],
			dayNamesMin: ['CN', 'T2', 'T3', 'T4', 'T5', 'T6', 'T7'] ,
			showWeek: true , showOn: 'both',
			changeMonth: true , changeYear: true,
			currentText: 'Hôm nay', weekHeader: 'Tuần'
			});
	});

</script>

<div style="color:red;text-align:center">
<?php
$id=  $this->uri->segment(4);
$row =$result;
 echo form_open_multipart('admin/advertisement/update/'.$id); 
if(isset($missing))
{
foreach ($missing as $item)
{
echo $item."<br />";
}
}?></div>
<div class="control2">

<?php

	echo form_submit('update', 'Save');

	echo form_submit('close', 'Close');

?>

</div><!--control2 end-->



<div class="box">

<div style="text-align:center;font-size:12px;padding:10px;color:#006699"><h2></h2> </div>

<div class="inner">
<?php
$data = array(
    'name'        => 'active',
    'id'          => 'active',
    'value'       => 'accept',
    'checked'     => false,
    'style'       => 'margin-top:5px;padding:0px;text-align:left;width:20px',
    );
($row['actived'] == 1) ? $data['checked']= true : $data['checked']= false;  
echo form_label("Kích hoạt"); echo form_checkbox($data);
?>
</div>
<div class="inner">
	<?php echo form_label("Ngày hết hạn");
	$code= "date";
	 $data = array('name'=>$code,'id'=>$code,'style'=>"width:397px;", 'value'=>"");
	echo form_input($data , set_value($code));
	
	?>
</div>
<div class="inner">
	<?php echo form_label("URL :");
	$code= "url";
	 $data = array('name'=>$code,'id'=>$code,'style'=>"width:350px;", 'value'=>$row["url"]);
	echo "http://".form_input($data , set_value($code));
	
	?>
</div>
<?php

//print_r($row);
// Loai san pham
	$code = "type";
	$label ="Loại quảng cáo";//$this->lang->line('cate_product');
	echo '<div class="inner">';

	if (! empty($missing) && array_key_exists($code, $missing))

		echo form_label($label, '', array('class'=>'error'));

	else

		echo form_label($label);

	$data = array('name' =>$code, 'size' =>'20', 'value' => set_value($code));
	
	?>
    <select id="cate" name="cate" validate="required:true, maxlength:2" style="width:150px;" >
    <option value="0">-- Chọn Loại QC --</option>
			<option value="1" <?php  echo ($row["type"]== 1)? "selected='selected'" : "" ?>> form </option>
        <option value="2" <?php  echo ($row["type"]== 2)? "selected='selected'" : "" ?> > chỉ có logo </option>
        	
		</select>
    <?php 

	echo '</div>';


// file upload
	$code = "img";
	$label =$this->lang->line('image');
	echo '<div class="inner">';

	if (! empty($missing) && array_key_exists($code, $missing))

		echo form_label($label, '', array('class'=>'error'));

	else

		echo form_label($label);

	$data = array('name' =>$code, 'size' =>'20', 'value' => set_value($code));

	echo form_upload($data);

	echo '</div>';
$code = "position";
	$label = "Vị trí";
echo '<div class="inner">';

	if (! empty($missing) && array_key_exists($code, $missing))

		echo form_label($label, '', array('class'=>'error'));

	else

		echo form_label($label);

//	$data = array('name' =>$code, 'size' =>'20', 'value' => set_value($code));

	//echo form_($data);

?>

    	<select name="position">
    	<option value="left"  <?php echo ($row['position']== "left")?'selected="selected"':''?> >Bên Trái </option>
    	<option value="right" <?php echo ($row['position']== "right")?'selected="selected"':''?> >Bên Phải</option>
    	<option value="bottom" <?php echo ($row['position']== "bottom")?'selected="selected"':''?> >Bên dưới </option>
     </select>
<?php

	echo '</div>';
$code = "priority";
	$label = "Thứ tự ưu tiên";
	echo '<div class="inner">';
	
		echo form_label($label);
	echo '<select name="'.$code.'">';
	for($i=1; $i<=10;$i++)
	{
		echo '<option value="'.$i.'" >'.$i.'</option>';
	}
	echo "</select>";
	echo "</div>";
	


?>

<div style="text-align:center;font-size:12px;padding:10px;color:#006699"><h2><?php echo $this->lang->line('product_name');?></h2> </div>
<?php
	$title = unserialize($row['name']);
	//title en

	echo '<div class="inner">';
	$code = "title_en";
	$label ="English";

	if (! empty($missing) && array_key_exists($code, $missing))

		echo form_label($label, '', array('class'=>'error'));

	else

		echo form_label($label);

	 $data = array('name'=>$code, 'value'=>html_entity_decode($title['en'],ENT_QUOTES,"UTF-8"));
	echo form_input($data , set_value($code));


	echo '</div>';

	//title  vi

echo '<div class="inner">';
	$code = "title_vi";
	$label ="Vietnamese";

	if (! empty($missing) && array_key_exists($code, $missing))

		echo form_label($label, '', array('class'=>'error'));

	else

		echo form_label($label);

	 $data = array('name'=>$code, 'value'=>html_entity_decode($title['vi'],ENT_QUOTES,"UTF-8"));
	echo form_input($data , set_value($code));

	echo '</div>';

	

?>





<div style="text-align:center;font-size:12px;padding:10px;color:#006699"><h2><?php echo $this->lang->line('product_detail');?></h2> </div>
<?php

	$detail = unserialize($row['info']);

$code = "detailed_content_vi";
	$label ="Vietnamese";
	echo '<div class="inner">';

	if (! empty($missing) && array_key_exists($code, $missing))

		echo form_label($label, '', array('class'=>'error'));

	else

		echo form_label($label);

	$data = array('name' =>$code, 'id' => $code, 'value' => html_entity_decode($detail['vi'],ENT_QUOTES,"UTF-8") );

	echo '<div class="textarea">'.form_textarea($data,set_value($code)).'</div>';

	echo '</div>';
	
	
		//detailed_content english
$code = "detailed_content_en";
	$label ="English";
	echo '<div class="inner">';

	if (! empty($missing) && array_key_exists($code, $missing))

		echo form_label($label, '', array('class'=>'error'));

	else

		echo form_label($label);

	$data = array('name' =>$code, 'id' => $code, 'value' => html_entity_decode($detail['en'],ENT_QUOTES,"UTF-8") );

	echo '<div class="textarea">'.form_textarea($data,set_value($code)).'</div>';
	echo '</div>';
	
	
	

?>




</div><!--end box-->



<?php

	echo form_close(); //FORM END

?>


<script type="text/javascript">

// This is a check for the CKEditor class. If not defined, the paths must be checked.
if ( typeof CKEDITOR == 'undefined' )
{
	document.write(
		'<strong><span style="color: #ff0000">Error</span>: CKEditor not found</strong>.' +
		'This sample assumes that CKEditor (not included with CKFinder) is installed in' +
		'the "/ckeditor/" path. If you have it installed in a different place, just edit' +
		'this file, changing the wrong paths in the &lt;head&gt; (line 5) and the "BasePath"' +
		'value (line 32).' ) ;
}
else
{

	var editor =		CKEDITOR.replace("detailed_content_vi");
	var editor2 =	CKEDITOR.replace("detailed_content_en");
	
	

	//editor.setData( '<p>Just click the <b>Image</b> or <b>Link</b> button, and then <b>&quot;Browse Server&quot;</b>.</p>' );
	//editor2.setData( '<p>Just click the <b>Image</b> or <b>Link</b> button, and then <b>&quot;Browse Server&quot;</b>.</p>' );
	//editor3.setData( '<p>Just click the <b>Image</b> or <b>Link</b> button, and then <b>&quot;Browse Server&quot;</b>.</p>' );
	// Just call CKFinder.SetupCKEditor and pass the CKEditor instance as the first argument.
	// The second parameter (optional), is the path for the CKFinder installation (default = "/ckfinder/").
	CKFinder.setupCKEditor( editor, '../../../includes/js/ckfinder') ;
	CKFinder.setupCKEditor( editor2, '../../../includes/js/ckfinder' ) ;
	

	// It is also possible to pass an object with selected CKFinder properties as a second argument.
	// CKFinder.SetupCKEditor( editor, { BasePath : '../../', RememberLastFolder : false } ) ;
}

		</script>